package edu.nf.db.util.result;

import edu.nf.db.util.RowProcessor;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Author lzp
 * @Date 2024-05-10
 */
public class BeanListHandler<T> extends AbstractListHandler<T>{
    private  Class<T> beanClass;

    public BeanListHandler(Class<T> beanClass) {
        this.beanClass = beanClass;
    }

    @Override
    public T handlerRow(ResultSet rs) throws SQLException {
        try {
            return RowProcessor.toBean(rs,beanClass);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
